<template lang="">
    <div>
        标题 <van-field v-model="title"/>
        价格 <van-field v-model="price"/>
        景区 <van-field v-model="typeid"/>
        图片 <van-uploader :after-read="upload" />
        <van-button @click="add">添加</van-button>

        <ul>
            <li v-for="i in list">{{i.title}}
                <img src="'http://localhost:5000'+i.pic" />
            </li>
        </ul>
    </div>
</template>

<script>
export default {
    data(){
        return{
            title:"",
            price:"",
            typeid:"",
            pic:"",
            list:[]
        }
    },
    methods:{
        upload(file){
            this.pic = file.file
        },
        add(){
            let formdata = new FormData()
            formdata.append('title',this.title)
            formdata.append('price',this.price)
            formdata.append('pid',this.pid)
            formdata.append('typeid',this.typeid)
            this.axios.post('course/scenicm',formdata).then(res=>{

            })   
        },
        getlist(){
            this.axios.get('course/scecicm').then(res=>{
                this.list = res.data.list
            })
        }
    },
    mounted(){
        this.getlist()
    },

}
</script>

<style lang="scss" scoped>

</style>